package com.ugoodtech.mdcc.core.repository;

import com.ugoodtech.mdcc.core.domain.AuditColorReport;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface AuditColorReportRepository extends CrudRepository<AuditColorReport, Long>, QueryDslPredicateExecutor<AuditColorReport> {

    @Query("from AuditColorReport where audit_report_id=:report_id and question_id=:question_id  and deleted=false and enabled=true")
    AuditColorReport selectReport(@Param("report_id") Long report_id, @Param("question_id") Long question_id);

    @Query("from AuditColorReport where audit_report_id=:report_id")
    List<AuditColorReport> selectAnswer(@Param("report_id") Long report_id);

    @Query("from AuditColorReport where audit_report_id=:report_id and question_id=:question_id  and deleted=false and enabled=true")
    AuditColorReport selectAuditReport(@Param("report_id") Long report_id, @Param("question_id") Long question_id);
}
